Optimal. Leaf size=159 \[ \frac {x}{a}+\frac {2 b^5 \tanh ^{-1}\left (\frac {a+b \tan \left (\frac {x}{2}\right )}{\sqrt {a^2-b^2}}\right )}{a \left (a^2-b^2\right )^{5/2}}-\frac {b^3 \sec (x)}{\left (a^2-b^2\right )^2}+\frac {b \sec (x)}{a^2-b^2}-\frac {b \sec ^3(x)}{3 \left (a^2-b^2\right )}+\frac {a b^2 \tan (x)}{\left (a^2-b^2\right )^2}-\frac {a \tan (x)}{a^2-b^2}+\frac {a \tan ^3(x)}{3 \left (a^2-b^2\right )} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.22, antiderivative size = 205, normalized size of antiderivative = 1.29, number of steps
used = 16, number of rules used = 9, integrand size = 13, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.692, Rules used = {3983, 2981,
2686, 3554, 8, 2814, 2739, 632, 212} \begin {gather*} -\frac {a b^2 x}{\left (a^2-b^2\right )^2}+\frac {a x}{a^2-b^2}+\frac {a \tan ^3(x)}{3 \left (a^2-b^2\right )}+\frac {a b^2 \tan (x)}{\left (a^2-b^2\right )^2}-\frac {a \tan (x)}{a^2-b^2}-\frac {b \sec ^3(x)}{3 \left (a^2-b^2\right )}+\frac {b \sec (x)}{a^2-b^2}+\frac {2 b^5 \tanh ^{-1}\left (\frac {a+b \tan \left (\frac {x}{2}\right )}{\sqrt {a^2-b^2}}\right )}{a \left (a^2-b^2\right )^{5/2}}+\frac {b^4 x}{a \left (a^2-b^2\right )^2}-\frac {b^3 \sec (x)}{\left (a^2-b^2\right )^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 212
Rule 632
Rule 2686
Rule 2739
Rule 2814
Rule 2981
Rule 3554
Rule 3983
Rubi steps
\begin {align*} \int \frac {\tan ^4(x)}{a+b \csc (x)} \, dx &=\int \frac {\sin (x) \tan ^4(x)}{b+a \sin (x)} \, dx\\ &=\frac {a \int \tan ^4(x) \, dx}{a^2-b^2}-\frac {b \int \sec (x) \tan ^3(x) \, dx}{a^2-b^2}+\frac {b^2 \int \frac {\sin (x) \tan ^2(x)}{b+a \sin (x)} \, dx}{a^2-b^2}\\ &=\frac {a \tan ^3(x)}{3 \left (a^2-b^2\right )}+\frac {\left (a b^2\right ) \int \tan ^2(x) \, dx}{\left (a^2-b^2\right )^2}-\frac {b^3 \int \sec (x) \tan (x) \, dx}{\left (a^2-b^2\right )^2}+\frac {b^4 \int \frac {\sin (x)}{b+a \sin (x)} \, dx}{\left (a^2-b^2\right )^2}-\frac {a \int \tan ^2(x) \, dx}{a^2-b^2}-\frac {b \text {Subst}\left (\int \left (-1+x^2\right ) \, dx,x,\sec (x)\right )}{a^2-b^2}\\ &=\frac {b^4 x}{a \left (a^2-b^2\right )^2}+\frac {b \sec (x)}{a^2-b^2}-\frac {b \sec ^3(x)}{3 \left (a^2-b^2\right )}+\frac {a b^2 \tan (x)}{\left (a^2-b^2\right )^2}-\frac {a \tan (x)}{a^2-b^2}+\frac {a \tan ^3(x)}{3 \left (a^2-b^2\right )}-\frac {\left (a b^2\right ) \int 1 \, dx}{\left (a^2-b^2\right )^2}-\frac {b^3 \text {Subst}(\int 1 \, dx,x,\sec (x))}{\left (a^2-b^2\right )^2}-\frac {b^5 \int \frac {1}{b+a \sin (x)} \, dx}{a \left (a^2-b^2\right )^2}+\frac {a \int 1 \, dx}{a^2-b^2}\\ &=-\frac {a b^2 x}{\left (a^2-b^2\right )^2}+\frac {b^4 x}{a \left (a^2-b^2\right )^2}+\frac {a x}{a^2-b^2}-\frac {b^3 \sec (x)}{\left (a^2-b^2\right )^2}+\frac {b \sec (x)}{a^2-b^2}-\frac {b \sec ^3(x)}{3 \left (a^2-b^2\right )}+\frac {a b^2 \tan (x)}{\left (a^2-b^2\right )^2}-\frac {a \tan (x)}{a^2-b^2}+\frac {a \tan ^3(x)}{3 \left (a^2-b^2\right )}-\frac {\left (2 b^5\right ) \text {Subst}\left (\int \frac {1}{b+2 a x+b x^2} \, dx,x,\tan \left (\frac {x}{2}\right )\right )}{a \left (a^2-b^2\right )^2}\\ &=-\frac {a b^2 x}{\left (a^2-b^2\right )^2}+\frac {b^4 x}{a \left (a^2-b^2\right )^2}+\frac {a x}{a^2-b^2}-\frac {b^3 \sec (x)}{\left (a^2-b^2\right )^2}+\frac {b \sec (x)}{a^2-b^2}-\frac {b \sec ^3(x)}{3 \left (a^2-b^2\right )}+\frac {a b^2 \tan (x)}{\left (a^2-b^2\right )^2}-\frac {a \tan (x)}{a^2-b^2}+\frac {a \tan ^3(x)}{3 \left (a^2-b^2\right )}+\frac {\left (4 b^5\right ) \text {Subst}\left (\int \frac {1}{4 \left (a^2-b^2\right )-x^2} \, dx,x,2 a+2 b \tan \left (\frac {x}{2}\right )\right )}{a \left (a^2-b^2\right )^2}\\ &=-\frac {a b^2 x}{\left (a^2-b^2\right )^2}+\frac {b^4 x}{a \left (a^2-b^2\right )^2}+\frac {a x}{a^2-b^2}+\frac {2 b^5 \tanh ^{-1}\left (\frac {a+b \tan \left (\frac {x}{2}\right )}{\sqrt {a^2-b^2}}\right )}{a \left (a^2-b^2\right )^{5/2}}-\frac {b^3 \sec (x)}{\left (a^2-b^2\right )^2}+\frac {b \sec (x)}{a^2-b^2}-\frac {b \sec ^3(x)}{3 \left (a^2-b^2\right )}+\frac {a b^2 \tan (x)}{\left (a^2-b^2\right )^2}-\frac {a \tan (x)}{a^2-b^2}+\frac {a \tan ^3(x)}{3 \left (a^2-b^2\right )}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 1.16, size = 194, normalized size = 1.22 \begin {gather*} \frac {\csc (x) (b+a \sin (x)) \left (-\frac {24 b^5 \text {ArcTan}\left (\frac {a+b \tan \left (\frac {x}{2}\right )}{\sqrt {-a^2+b^2}}\right )}{\left (-a^2+b^2\right )^{5/2}}+\frac {\sec ^3(x) \left (2 a^3 b-8 a b^3+9 \left (a^2-b^2\right )^2 x \cos (x)+6 a b \left (a^2-2 b^2\right ) \cos (2 x)+3 a^4 x \cos (3 x)-6 a^2 b^2 x \cos (3 x)+3 b^4 x \cos (3 x)+3 a^2 b^2 \sin (x)-4 a^4 \sin (3 x)+7 a^2 b^2 \sin (3 x)\right )}{(a-b)^2 (a+b)^2}\right )}{12 a (a+b \csc (x))} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.20, size = 190, normalized size = 1.19
method | result | size |
default | \(-\frac {64}{3 \left (\tan \left (\frac {x}{2}\right )-1\right )^{3} \left (64 a +64 b \right )}-\frac {32}{\left (64 a +64 b \right ) \left (\tan \left (\frac {x}{2}\right )-1\right )^{2}}-\frac {-2 a -3 b}{2 \left (a +b \right )^{2} \left (\tan \left (\frac {x}{2}\right )-1\right )}-\frac {2 b^{5} \arctan \left (\frac {2 b \tan \left (\frac {x}{2}\right )+2 a}{2 \sqrt {-a^{2}+b^{2}}}\right )}{\left (a -b \right )^{2} \left (a +b \right )^{2} a \sqrt {-a^{2}+b^{2}}}-\frac {64}{3 \left (\tan \left (\frac {x}{2}\right )+1\right )^{3} \left (64 a -64 b \right )}+\frac {32}{\left (64 a -64 b \right ) \left (\tan \left (\frac {x}{2}\right )+1\right )^{2}}-\frac {-2 a +3 b}{2 \left (a -b \right )^{2} \left (\tan \left (\frac {x}{2}\right )+1\right )}+\frac {2 \arctan \left (\tan \left (\frac {x}{2}\right )\right )}{a}\) | \(190\) |
risch | \(\frac {x}{a}-\frac {2 \left (6 i a^{3} {\mathrm e}^{4 i x}-9 i a \,b^{2} {\mathrm e}^{4 i x}-3 a^{2} b \,{\mathrm e}^{5 i x}+6 b^{3} {\mathrm e}^{5 i x}+6 i a^{3} {\mathrm e}^{2 i x}-12 i a \,b^{2} {\mathrm e}^{2 i x}-2 a^{2} b \,{\mathrm e}^{3 i x}+8 b^{3} {\mathrm e}^{3 i x}+4 i a^{3}-7 i a \,b^{2}-3 a^{2} b \,{\mathrm e}^{i x}+6 \,{\mathrm e}^{i x} b^{3}\right )}{3 \left (-a^{2}+b^{2}\right )^{2} \left ({\mathrm e}^{2 i x}+1\right )^{3}}+\frac {b^{5} \ln \left ({\mathrm e}^{i x}+\frac {i b \sqrt {a^{2}-b^{2}}+a^{2}-b^{2}}{\sqrt {a^{2}-b^{2}}\, a}\right )}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right )^{2} \left (a -b \right )^{2} a}-\frac {b^{5} \ln \left ({\mathrm e}^{i x}+\frac {i b \sqrt {a^{2}-b^{2}}-a^{2}+b^{2}}{\sqrt {a^{2}-b^{2}}\, a}\right )}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right )^{2} \left (a -b \right )^{2} a}\) | \(305\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 3.51, size = 483, normalized size = 3.04 \begin {gather*} \left [\frac {3 \, \sqrt {a^{2} - b^{2}} b^{5} \cos \left (x\right )^{3} \log \left (\frac {{\left (a^{2} - 2 \, b^{2}\right )} \cos \left (x\right )^{2} + 2 \, a b \sin \left (x\right ) + a^{2} + b^{2} + 2 \, {\left (b \cos \left (x\right ) \sin \left (x\right ) + a \cos \left (x\right )\right )} \sqrt {a^{2} - b^{2}}}{a^{2} \cos \left (x\right )^{2} - 2 \, a b \sin \left (x\right ) - a^{2} - b^{2}}\right ) - 2 \, a^{5} b + 4 \, a^{3} b^{3} - 2 \, a b^{5} + 6 \, {\left (a^{6} - 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} - b^{6}\right )} x \cos \left (x\right )^{3} + 6 \, {\left (a^{5} b - 3 \, a^{3} b^{3} + 2 \, a b^{5}\right )} \cos \left (x\right )^{2} + 2 \, {\left (a^{6} - 2 \, a^{4} b^{2} + a^{2} b^{4} - {\left (4 \, a^{6} - 11 \, a^{4} b^{2} + 7 \, a^{2} b^{4}\right )} \cos \left (x\right )^{2}\right )} \sin \left (x\right )}{6 \, {\left (a^{7} - 3 \, a^{5} b^{2} + 3 \, a^{3} b^{4} - a b^{6}\right )} \cos \left (x\right )^{3}}, \frac {3 \, \sqrt {-a^{2} + b^{2}} b^{5} \arctan \left (-\frac {\sqrt {-a^{2} + b^{2}} {\left (b \sin \left (x\right ) + a\right )}}{{\left (a^{2} - b^{2}\right )} \cos \left (x\right )}\right ) \cos \left (x\right )^{3} - a^{5} b + 2 \, a^{3} b^{3} - a b^{5} + 3 \, {\left (a^{6} - 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} - b^{6}\right )} x \cos \left (x\right )^{3} + 3 \, {\left (a^{5} b - 3 \, a^{3} b^{3} + 2 \, a b^{5}\right )} \cos \left (x\right )^{2} + {\left (a^{6} - 2 \, a^{4} b^{2} + a^{2} b^{4} - {\left (4 \, a^{6} - 11 \, a^{4} b^{2} + 7 \, a^{2} b^{4}\right )} \cos \left (x\right )^{2}\right )} \sin \left (x\right )}{3 \, {\left (a^{7} - 3 \, a^{5} b^{2} + 3 \, a^{3} b^{4} - a b^{6}\right )} \cos \left (x\right )^{3}}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\tan ^{4}{\left (x \right )}}{a + b \csc {\left (x \right )}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.42, size = 216, normalized size = 1.36 \begin {gather*} -\frac {2 \, {\left (\pi \left \lfloor \frac {x}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (b\right ) + \arctan \left (\frac {b \tan \left (\frac {1}{2} \, x\right ) + a}{\sqrt {-a^{2} + b^{2}}}\right )\right )} b^{5}}{{\left (a^{5} - 2 \, a^{3} b^{2} + a b^{4}\right )} \sqrt {-a^{2} + b^{2}}} + \frac {x}{a} + \frac {2 \, {\left (3 \, a^{3} \tan \left (\frac {1}{2} \, x\right )^{5} - 6 \, a b^{2} \tan \left (\frac {1}{2} \, x\right )^{5} + 3 \, b^{3} \tan \left (\frac {1}{2} \, x\right )^{4} - 10 \, a^{3} \tan \left (\frac {1}{2} \, x\right )^{3} + 16 \, a b^{2} \tan \left (\frac {1}{2} \, x\right )^{3} + 6 \, a^{2} b \tan \left (\frac {1}{2} \, x\right )^{2} - 12 \, b^{3} \tan \left (\frac {1}{2} \, x\right )^{2} + 3 \, a^{3} \tan \left (\frac {1}{2} \, x\right ) - 6 \, a b^{2} \tan \left (\frac {1}{2} \, x\right ) - 2 \, a^{2} b + 5 \, b^{3}\right )}}{3 \, {\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} {\left (\tan \left (\frac {1}{2} \, x\right )^{2} - 1\right )}^{3}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 7.38, size = 2500, normalized size = 15.72 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________